package common;

import org.junit.jupiter.api.Test;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;

import java.time.Duration;
import java.util.List;

/**
 * @program: blogtest
 * @author: JCM
 * @create: 2023-10-18 16:41
 * @description:
 **/
public class Autotest {
    public static ChromeDriver driver;
    public static ChromeDriver createDriver() {
        // 1. 设置 Property
        System.setProperty("webdriver.chrome.driver","C:\\Program Files\\Google\\Chrome\\Application\\chromedriver.exe");
        // 2. 设置 ChromeOptions
        ChromeOptions options = new ChromeOptions();
        options.addArguments("--remote-allow-origins=*");
        // 3. 创建 driver
        driver = new ChromeDriver(options);
        // 隐式等待一会，让页面渲染完成
        driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(3));
        return driver;
    }

}
